package cn.eud360.xiangmu.dmp.config

import java.util.Properties

import com.typesafe.config.{Config, ConfigFactory}
import scalikejdbc.config.DBs

//解析配置文件 application.conf  注意一定是object类型
object ConfigHelper {
  private lazy val config: Config = ConfigFactory.load()
  //解析saprk.serializer
  val serializer: String = config.getString("spark.serializer")
  val dmplogpath: String = config.getString("dmp.log.path")
  val parquetoutpath: String = config.getString("dmp.parquet.outpath")
  //版本2格式的路径输出
  val parquetoutpath2: String = config.getString("dmp.parquet.outpath2")
  //压缩格式
  val snappy: String = config.getString("spark.sql.parquet.compression.codec")
  //省市统计结果输出路径
  val dmpparquetprocityoutpath: String = config.getString("dmp.parquet.procity.outpath")
  //省市统计结果输出路径(sparkcore)
   val sparkcorejsonpath: String = config.getString("jsoncoreoutpath")
  val driverscala: String = config.getString("db.default.driver")
  val userscala: String = config.getString("db.default.user")
  val passwordscala: String = config.getString("db.default.password")
  val urlscala: String = config.getString("db.default.url")
  val tablescala: String = config.getString("db.default.table")
   //加载数据库
 val  setupMySQL: Unit = DBs.setup()
  //area报表
 val tablearar: String = config.getString("db.default.table1")
  //app字典路径
 val appDictFilePath: String = config.getString("app.dict.path")



  // 解析redis的配置

  val redisHost: String = config.getString("db.redis.host")
  val redisPort = config.getInt("db.redis.port")
  //redis连接池相关参数设置
  val redisSetMaxTotal=config.getInt("redispool.maxtotal")  //设置最大连接量
  val redisSetMaxIdle=config.getInt("redispool.maxidle")     //支持最大的空闲连接
  val redisKu=config.getInt("db.redis.ku")



  //用sparksql写数据库
  val url="jdbc:mysql://127.0.0.1:3306/wjy1?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&zeroDateTimeBehavior=convertToNull&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&autoReconnect=true&failOverReadOnly=false&useSSL=true"
  val table="t_report_app_fenxi"
  val tableredis="t_report_app_fenxi_redis31"
  val conn: Properties = new Properties()
  conn.setProperty("usr","wjy1")
  conn.setProperty("password","351991")
  conn.setProperty("driver","com.mysql.jdbc.Driver")

}
